<?php 
	session_start(); 
	// echo "输出sessionid = " . session_id() . "<br>";

	class SessionInfo {
		static function setLoginInfo($key, $value) {
			$_SESSION[$key] = $value;
			// echo "存入成功" . "<br>";
			// echo "$key = " . $_SESSION[$key];
		}

		static function getLoginInfo($key) {
			@$value = $_SESSION[$key];
			// echo "输出$key = " . $value . "<br>";
			
			return $value;
		}
		static function checkAdminLogin(){
			$name = SessionInfo::getLoginInfo("adminUsername");
			$pwd = SessionInfo::getLoginInfo("adminPassword");
			// 未登录，直接先跳登录页面
			if ($name == "") {
				header("Location:login.php", true);
			}
		}

		static function outAdminLogin() {
			SessionInfo::setLoginInfo("adminUsername", NULL);
			SessionInfo::setLoginInfo("adminPassword", NULL);
			header("Location:login.php", true);
		}
	}

	 
 	
?>
